<script>
_h=h= Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
var sWidth = parseInt((window.innerWidth > 0) ? window.innerWidth : screen.width);
if(sWidth>750){sWidth=750;}
var _rate=(sWidth/750);
if(h<_rate*1206){h=_rate*1206;}
var _img=['home-s1.png'];
var loader = new PxLoader();
for(var i=0; i<_img.length; i++){loader.addImage('./img/'+_img[i]);}
loader.start();
loader.addCompletionListener(function(e){
	   $(".p1").fadeIn(800).css({"opacity":1});
	   $(".p-s, .p-c2, .p-c3").hide().css({"opacity":1});
});
$(function(){
	document.body.addEventListener('touchmove', function (e) {
		  e.preventDefault();  
	}, {passive: false})
	$('.container, .page, .bigbg').width(sWidth).height(h);
	$('.thebg, .p-b').width(sWidth).height(_rate*1206);
	$('.home-x1, .home-x2, .home-x3, .home-x4').width(_rate*521).height(_rate*145);
	$('.home-x1').css({"top":_rate*772, "left":_rate*62});
	$('.home-x2').css({"top":_rate*870, "left":_rate*156});
	$('.home-x3').css({"top":_rate*968, "left":_rate*62});
	$('.home-x4').css({"top":_rate*1064, "left":_rate*154});
	
	$('.home-xg2').width(_rate*145).height(_rate*145).css({"left":_rate*3});
 
	
	$('.xlie-t2').css({"top":_rate*100});
	$('.xlie-t3').css({"top":_rate*162});
	$('.xlie-t4').css({"top":_rate*592});
	$('.xlie-t5').css({"top":_rate*738});
	$('.xlie-z1').width(_rate*374).height(_rate*141).css({"top":_rate*450, "left":_rate*178});
	$('.xlie-z2').width(_rate*90).height(_rate*50).css({"top":_rate*13, "left":_rate*52});
	$('.xlie-z3').width(_rate*81).height(_rate*48).css({"top":_rate*67, "left":_rate*34});
	$('.xlie-z4').width(_rate*197).height(_rate*41).css({"top":_rate*1027, "left":_rate*125});
	$('.xlie-z5').width(_rate*232).height(_rate*41).css({"top":_rate*1027, "left":_rate*410});
	$('.hxin-z1').width(_rate*203).height(_rate*50).css({"top":_rate*346, "left":_rate*172});
	$('.hxin-z2').width(_rate*165).height(_rate*39).css({"top":_rate*874, "left":_rate*190});
	$('.hxin-title').css({"top":_rate*100});
	$('.hxin-t2').css({"top":_rate*152});
	$('.hxin-t3').css({"top":_rate*604});
	$('.hxin-t4').css({"top":_rate*706});
	$('.hx2-t2').css({"top":_rate*124});
	$('.hx2-t3').css({"top":_rate*632});
	$('.hx2-t4').css({"top":_rate*794});
	$('.p-s, .p-c2, .p-c3').width(_rate*750).height(h); 
	$('.arw').width(_rate*41).height(_rate*46).css({"left":_rate*354});
	$('.zdi-t2').css({"top":_rate*162});
	$('.zdi-t3').css({"top":_rate*504});
	$('.zdi-t4').css({"top":_rate*640});
	$('.zd2-t2').css({"top":_rate*100});
	$('.zd2-t3').css({"top":_rate*584});
	$('.zd2-t4').css({"top":_rate*742});
	$('.brand-t2').css({"top":_rate*172});
	$('.brand-t3').css({"top":_rate*570});
	$('.brand-t4').css({"top":_rate*688});
	$('.bd2-t1').css({"top":_rate*152});
	$('.bd2-t2').css({"top":_rate*230});
	$('.home-back').width(_rate*180).height(_rate*90).css({"left":_rate*285});
	$('.hx2-z1').width(_rate*424).height(_rate*46).css({"top":_rate*210, "left":_rate*158});
	$('.hx2-z2').width(_rate*347).height(_rate*57).css({"top":_rate*866, "left":_rate*198});
	$('.hx2-z3').width(_rate*492).height(_rate*70).css({"top":_rate*526, "left":_rate*222});

	$('.zdi-z1, .zdi-z2, .zdi-z3, .zdi-z4').width(_rate*114).height(_rate*47);
	$('.zdi-z1').css({"top":_rate*796, "left":_rate*208});
	$('.zdi-z2').css({"top":_rate*796, "left":_rate*540});
	$('.zdi-z3').css({"top":_rate*1060, "left":_rate*208});
	$('.zdi-z4').css({"top":_rate*1060, "left":_rate*540});
	
	
	if(h > _rate*1206){
		   var _cha= (h - _rate*1306)/2;
		   if(_cha > 0){
		      $('.thebg').css({"top":_cha});
		      $('.home-z1-x').css({"top":_rate*40});
		      $(".hxin-x").attr("src","<?php echo $cdnUrl; ?>img/hxin-x.jpg");
		      $(".hxin-x").height(_rate*1448);
 
            }
      }
	 
	var swiper = new Swiper('.p-s', {
		   initialSlide:0,
		   direction:'vertical',
		   speed:160,
		   touchAngle:360,
		   on:{
		        transitionStart: function(){
		        	$(".arw").hide();
		        	$(".hx2 .animated, .hxin .animated").hide();
				   
		        },
		        transitionEnd: function(swiper){
		        	$(".arw").show();
		        	$(".hx2 .animated, .hxin .animated").show();
		          }
		        }
	    });


	var swiper2= new Swiper('.p-c2', {
		   initialSlide:0,
		   direction:'vertical',
		   speed:160,
		   touchAngle:360,
		   on:{ transitionStart: function(){ $(".arw").hide(); 
		         console.log(this.activeIndex);
		         if(1 == this.activeIndex){
                    $(".bd2 .animated").hide();
			     } 
		   },
		        transitionEnd: function(swiper){ $(".arw").show(); 
		        console.log('end:'+this.activeIndex);
		        $(".bd2 .animated").show();
		  }}});
	var swiper3= new Swiper('.p-c3', {
		   initialSlide:0,
		   direction:'vertical',
		   speed:160,
		   touchAngle:360,
		   on:{ transitionStart: function(){ $(".arw").hide(); 
    		     if(0 == this.activeIndex){
                   $(".zdi .animated, .zdi-t4-B, .zdi-z1, .zdi-z2, .zdi-z3, .zdi-z4, .zdi-t4-B").hide();
                   $(".zdi-t4-A").show(); 
    		     }
    		     if(1 == this.activeIndex){
                   $(".zd2 .animated").hide();
    		     }
		   },
		        transitionEnd: function(swiper){ $(".arw").show(); 
		        if(1 == this.activeIndex){
                    $(".zd2 .animated").show();
                    $(".zdi-t4-A").hide(); 
                 	$(".zdi-z1, .zdi-z2, .zdi-z3, .zdi-z4, .zdi-t4-B").hide();
			     }
		         if(0 == this.activeIndex){
	                   $(".zdi .animated").show();
	                   window.setTimeout(function(){
	                	   $(".zdi-t4-B").show();
	                	   $(".zdi-t4-A").fadeOut(); 
    	                   window.setTimeout(function(){
    	                	   $(".zdi-z1, .zdi-z2, .zdi-z3, .zdi-z4").show();
    		                   }, 500);
	                   }, 1200);
	    		     }
		        } } });

	var _homeId=1;
    function _homeAni(){
        if(_homeId > 4){_homeId=1;}
        //window.setTimeout(function(){$(".home-x"+_homeId+" .home-xg2").show().addClass(" ani12 fla2");}, 1260);
        if(1 == _homeId){
            $(".home-x1-2, .xg1").show().addClass(" ani12 pulse");
            $(".home-x4-2").removeClass("ani12").removeClass("pulse");
            $(".xg4").removeClass("ani12").removeClass("pulse");
            //$(".home-x4 .home-xg2").removeClass("ani12").removeClass("fla2").hide();
        }
        if(2 == _homeId){
            $(".home-x2-2, .xg2").show().addClass(" ani12 pulse");
            $(".home-x1-2").removeClass("ani12").removeClass("pulse");
            $(".xg1").removeClass("ani12").removeClass("pulse");
        }
        if(3 == _homeId){
            $(".home-x3-2, .xg3").show().addClass(" ani12 pulse");
            $(".home-x2-2").removeClass("ani12").removeClass("pulse");
            $(".xg2").removeClass("ani12").removeClass("pulse");
        }
        if(4 == _homeId){
            $(".home-x4-2, .xg4").show().addClass(" ani12 pulse");
            $(".home-x3-2").removeClass("ani12").removeClass("pulse");
            $(".xg3").removeClass("ani12").removeClass("pulse");
        }
        window.setTimeout(function(){
        	$(".xg"+_homeId).fadeOut();
        	_homeId++;
        	_homeAni();
            }, 2200);
    }
    window.setTimeout(function(){
    	_homeAni();
        }, 1800);
    $(".home-x1").click(function(){
      $(".home").fadeOut();
      $(".xlie").fadeIn();
      _subFlag=false;
      _xlieAni();
    });
    
    $(".home-x2").click(function(){
        $(".home").fadeOut();
        $(".p-s").fadeIn();
        $(".arw").show();
        $(".hxin .animated").show();
      });
    $(".home-x3").click(function(){
        $(".home").fadeOut();
        $(".p-c3").fadeIn();
        $(".arw").show();
        $(".zdi .animated").show();
        window.setTimeout(function(){
        	 $(".zdi-t4-B").show();
             $(".zdi-t4-A").hide(); 
             window.setTimeout(function(){
          	   $(".zdi-z1, .zdi-z2, .zdi-z3, .zdi-z4").show();
                 }, 500);
            }, 1200);
      });
    $(".home-x4").click(function(){
        $(".home").fadeOut();
        $(".p-c2").fadeIn();
        $(".arw").show();
      });
    $('.home-back').click(function(){
    	_homeId=0;
    	_subFlag=true;
        $(".xlie, .p-s, .p-c2, .p-c3").fadeOut();
        $(".home").fadeIn();
        window.setTimeout(function(){
        	swiper.slideTo(0, 100, false);
        	swiper2.slideTo(0, 100, false);
        	swiper3.slideTo(0, 100, false);
            }, 1200);
    });

    window.setTimeout(function(){
    	 //$(".home").fadeOut();
    	 //$(".p-c3").fadeIn();
        }, 1800);
    

    var _subFlag=true;
    var _xlieId=0;
    function _xlieAni(){
        if(_subFlag){return;}
    	_xlieId++;
        if(1 == _xlieId){
        	//$(".xlie-z2").addClass(" ani12 heartBeat");
        	//$(".xlie-z3").removeClass("ani12").removeClass("heartBeat");
        	//$('.xlie-z4').addClass(" ani12 pulse");
        	//$(".xlie-z5").removeClass("ani12").removeClass("pulse");
        	
        }else{
        	_xlieId=0;
        	//$(".xlie-z3").addClass(" ani12 heartBeat");
        	//$(".xlie-z2").removeClass("ani12").removeClass("heartBeat");
        	//$('.xlie-z5').addClass(" ani12 pulse");
        	//$(".xlie-z4").removeClass("ani12").removeClass("pulse");
         }
        window.setTimeout(function(){
        	_xlieAni();
            }, 2000);
    }

    wx.config({
        appId: '<?php echo $signPackage["appId"];?>',
        timestamp: <?php echo $signPackage["timestamp"];?>,
        nonceStr: '<?php echo $signPackage["nonceStr"];?>',
        signature: '<?php echo $signPackage["signature"];?>',
        jsApiList: ['updateAppMessageShareData', 'updateTimelineShareData', 'showMenuItems', 'hideMenuItems']
    });
    wx.ready(function () {
    		var _title='URARA';
    		var _desc='悠莱 恒采之能奢宠';
    		var _link='http://mei94.com/urara03/';
    		var _imgUrl='http://mei94.com/urara03/img/64.jpg';
    			wx.updateAppMessageShareData({
    			    title: _title, 
    			    desc: _desc, 
    			    link: _link, 
    			    imgUrl: _imgUrl, 
    			    success: function () {
    			    }
    			  })
    			 wx.updateTimelineShareData({ 
                      title: _title, 
                      link: _link, 
                      imgUrl: _imgUrl, 
                      success: function () {
                      }
                    })

    });
   
	
  
});
</script>